Ext.define('PJ.view.messagemanagement.AttachmentList', {
    extend: 'AM.default.DefaultList',
    alias: ['widget.attachmentList'],
    requires: ['AM.default.DefaultSearchForm', 
               'AM.default.DateTime', 
               'AM.default.DefaultDateField'
               ],
   selModel: {
       selType: '',
       checkOnly: true
   },
   isHavePage:false,
   autoScroll:false,
    initComponent: function(){
    	var me = this;
        me.columns = [{
    		header: '附件名称',
    		dataIndex: 'attachName',
    		flex: 1,
            minWidth: 120,
    		renderer: function(value, meta, record){
    			meta.tdAttr = "data-qtip='" + value + "'";
    			return value;
    		}
    	}, {
    		header: '类型',
    		dataIndex: 'attachType'
    	}, {
            header: '大小',
            dataIndex: 'fileSize',
            width:120,
    		renderer: function(value, metaData, record){
    			metaData.tdAttr = 'data-qtip="' + value + '"';
    			return value;
    		}
        }, {
            header: '操作',
            menuDisabled: true,
            sortable: false,
            resizable: false,
            hideable: false,
            xtype: 'actioncolumn',
            width: 75,
            items: [{
            	tooltip: '下载',
            	getClass: function(v, meta, rec){
            		meta.style = "cursor: pointer;";
            		if(rec.get("attachmentId")==""||rec.get("attachmentId")==null){
            			return "";
            		}else{
            			return 'downIcon';
            		}
        		},
                handler: function(grid, rowIndex, colIndex, item, eve, record){
                    var store =grid.up('window').grid.getStore();
                    var atag = Ext.get("exportResume");
                    var attachmentId = record.get('attachmentId');
                    var attachNameType = record.get('attachName')+record.get('attachType');
                    var href = store.downloadUrl + "?sn=" + encodeURIComponent(attachmentId) +
													"&name=" + encodeURIComponent(attachNameType);
                    atag.set({
                        "href":href 
                    });
                    atag.dom.click();
                }
            }]
        }];
        me.store = Ext.create('PJ.'+ prototype +'.messagemanagement.AttachmentList', {
            isLoad: false
        });
        this.loadType = gj_onlineLearning_constant.loadType;//加载方式
        me.callParent(arguments);
    }
    /*listeners: {
    	viewready: function(){
    		var me = this;
            var store = this.store;
            var params = store.proxy.extraParams;
            var newParams = {};
            Ext.apply(params, newParams);
            store.isLoad = true;
            store.load();
    		// 触发权限过滤事件
    		this.fireEvent("permission", this);
    	}
    }*/
});
